﻿@page
@model FytSoa.Web.Pages.FytAdmin.Shop.CouponLogModel
@{
    ViewData["Title"] = "优惠券管理";
    Layout = "~/Pages/FytAdmin/_Layout.cshtml";
}
<div id="container">
    <div class="list-wall">
        <table class="layui-hide" id="tablist" lay-filter="tool"></table>
    </div>
    <script>
        layui.config({
            base: '/themes/js/modules/'
        }).use(['table', 'layer', 'jquery', 'common'],
            function () {
                var table = layui.table,
                    layer = layui.layer,
                    $ = layui.jquery,
                    os = layui.common;
                var guid = os.getUrlParam('guid');
                table.render({
                    elem: '#tablist',
                    headers: os.getToken(),
                    url: '/api/shop/coupon/loglist',
                    cols: [
                        [
                            { field: 'number', width: 210, title: '号码' },
                            {
                                field: 'isUse', title: '是否使用', width: 100, templet: function (data) {
                                    return data.isUse ? '<span class="layui-badge layui-bg-orange">已使用</span>' : '<span class="layui-badge layui-bg-blue">未使用</span>';
                                }
                            },
                            { field: 'nickName', title: '使用者' },
                            { field: 'userTime', width: 180, title: '使用时间' },
                            { field: 'getType', width: 120, title: '用户获得方式' }
                        ]
                    ],
                    where: {
                        guid:guid
                    },
                    page: true,
                    id: 'tables',
                    parseData: function (res) {
                        console.log(res.data.items);
                        return {
                            "code": res.statusCode === 200 ? 0 : res.statusCode,
                            "msg": res.message,
                            "count": res.data.totalItems,
                            "data": res.data.items
                        };
                    }
                });

            });
    </script>
</div>